<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $task_id 朋友圈任务ID
 * @property int $robot_id 机器人ID
 * @property string $sns_id 朋友圈ID
 * @property int $friend_circle_status 朋友圈发布状态
 * @property array $comment_status 评论发送状态
 * @property array $comment_id 评论ID
 * @property int $timing_delete_switch 定时删除开关：0=关闭 1=开启
 * @property string $timing_delete_hour 定时删除时间，单位小时
 * @property int $timing_delete_time 删除时间
 * @property \Carbon\Carbon $created_at 发布时间
 * @property \Carbon\Carbon $updated_at 
 * @property-read null|ChFriendCircleTask $task 
 * @property-read null|ChRobot $robot 
 */
class ChFriendCircleTaskSendRecord extends MineModel
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_friend_circle_task_send_record';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'task_id', 'robot_id', 'sns_id', 'friend_circle_status', 'comment_status', 'comment_id', 'timing_delete_switch', 'timing_delete_hour', 'timing_delete_time', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'task_id' => 'integer', 'robot_id' => 'integer', 'friend_circle_status' => 'integer', 'comment_status' => 'array', 'comment_id' => 'array', 'timing_delete_switch' => 'integer', 'timing_delete_hour' => 'decimal:2', 'timing_delete_time' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    /**
     * 任务
     * @return \Hyperf\Database\Model\Relations\HasOne
     */
    public function task(): \Hyperf\Database\Model\Relations\HasOne
    {
        return $this->hasOne(ChFriendCircleTask::class, 'id', 'task_id');
    }

    /**
     * 机器人
     * @return \Hyperf\Database\Model\Relations\HasOne
     */
    public function robot(): \Hyperf\Database\Model\Relations\HasOne
    {
        return $this->hasOne(ChRobot::class, 'id', 'robot_id');
    }
}
